﻿using B.S.Material.ErrorCode;
using B.S.Material.Wirth.Api.Applications.Command.ProductionWasteZCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Material.Wirth.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductionWasteZController : ControllerBase
    {
        private readonly IMediator mediator;
        public ProductionWasteZController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 生产废料主添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<object>> AddProductionWasteZ(AddProductionWasteZCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 生产废料主修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateProductionWasteZ(UpdateProductionWasteZCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 生产废料主删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<ApiResult<int>> DelProductionWasteZ(DelProductionWasteZCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
